# TODO: logic circuit library, quick basics:
# 
# format of a circuit in memory: sequence of blocks, a block is 4 numbers:
# T S A B
#
# T: 8bit type (AND, OR, IN, OUT, XOR, BUFFER, NOT, NULL, ...)
# S: 8bit state (current value, i.e. 1 or 0, "needs update" flag for recursive
#    eval etc.)
# A: index of first input (probably 32 bit to allow large circuits)
# B: index of second input (-||-)
#
# Probably like this:
#
# TAAA  SBBB
# \__/  \__/
# 32bit 32bit
#
# so the whole lib will work in 32 bit env.
#
# the circuit starts with NULL block, then blocks follow, and ends with NULL.
# Nth IN block inside it represents Nth input, Nth OUT block represents Nth
# output.
#
# Then just make functions that work with circuits, e.g. addBlock, mergeCircuits
# (merges two circuits with parameters saying which inputs connect to which
# outputs), runCircuit (recursively evaluates circuit from each output) etc.
